<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<div id="tools" style="padding:5px;height:auto">
		<div style="margin-bottom:5px; margin-top: 5px; margin-left: 5px">
			<a href="javascript:void(0)" class="easyui-linkbutton" id="btn_action" iconCls="icon-edit" plain="true">处理</a>
		</div>
	</div>
	<!-- 列表信息 -->
	<table id="datagrid" class="easyui-datagrid" data-options="singleSelect:true,fit:true,fitColumns:true,
		pagination:true,pageSize:15,pageList:[5,10,15,20],toolbar:'#tools',url:'searchdo'">
		<thead>
			<tr>
				<th data-options="field:'id',hidden:true">id</th>
				<th data-options="field:'SRC_UNIT_ID',hidden:true">来源部门id</th>
				<th data-options="field:'BILL_ID',hidden:true">单据id</th>
				<th data-options="field:'SRC_UNIT_NAME',width:30">来源部门</th>
				<th data-options="field:'TRUE_NAME',width:30">经办人</th>
				<th data-options="field:'BILL_TIME',width:30">办理时间</th>
				<th data-options="field:'ACTION_END_TIME',hidden:true">截止时间</th>
				<th data-options="field:'ACTIVE_NAME',width:10">状态</th>
			</tr>
		</thead>
	</table>
	<!-- 处理窗口 办公室流转信息 -->
	<div id="div_end_action_window" class="easyui-window" title="处理信息"  data-options="modal:true,collapsible:false,closed:true,minimizable:false,
		maximizable:false" style="padding: 15px; width:550px; line-height: 20px;">
		<div id="div_end_comBill_info"></div>
		<div>
				<table align="center">
					<tr>
						<td width="100px">答复内容:</td>
						<td width="400px" colspan="3" id="td_end_exam_content"></td>
					</tr>
				</table>
			</div>
		<form id="form_end_action" method="post" class="easyui-form" data-options="novalidate:true">
			<!-- 单据编号 -->
			<input type="hidden" name="com_bill_id" id="hid_end_com_bill_id" value="" />
			<!-- 流转单编号 -->
			<input type="hidden" name="cir_bill_id" id="hid_end_cir_bill_id" value="" />
			<input type="hidden" name="exa_bill_id" id="hid_end_exa_bill_id" value="" />
			<div>
				<table align="center">
					<tr>
						<td colspan="2">&nbsp;</td>
					</tr>
					<tr>
						<td width="100px">满意度:</td>
						<td width="400px" height="50px;" colspan="3"><input type="text" name="satisfy" style="width:300px" class="easyui-slider" id="satisfy" data-options="showTip:true,rule:[0,'|',50,'|',100],step:50" /></td>
					</tr>
					<tr>
						<td colspan="2">&nbsp;</td>
					</tr>
					<tr>
						<td width="100px" valign="top">备注:</td>
						<td width="400px">
							<input class="easyui-textbox" data-options="multiline:true" style="height:170px;width:350px;" type="text" name="remark"></input>
						</td>
					</tr>
				</table>
			</div>
			<div style="width: 99%; height:50px;">
			</div>
			<div style="width: 100%; text-align: center; line-height: 40px;">
				<a href="javascript:void(0)" class="easyui-linkbutton" id="btn_end_answer" iconCls="icon-redo">答复</a>
			</div>
		</form>
	</div>
	<!-- 处理窗口 其他部门流转到办公室 -->
	<div id="div_action_office_window" class="easyui-window" title="处理信息"  data-options="modal:true,collapsible:false,closed:true,minimizable:false,
		maximizable:false" style="padding: 15px; width:550px; line-height: 20px;">
		<div id="div_office_comBill_info"></div>
		<div>
				<table align="center">
					<tr>
						<td width="100px">处理部门:</td>
						<td width="150px" id="td_office_unitname"></td>
						<td width="100px">处理结果:</td>
						<td width="150px" id="td_office_answer"></td>
					</tr>
					<tr>
						<td width="100">原因:</td>
						<td width="400px" colspan="3" id="td_office_reson"></td>
					</tr>
				</table>
			</div>
		<form id="form_office_action" method="post" class="easyui-form" data-options="novalidate:true">
		<div>
				<table align="center">
					<tr>
						<td width="100px">处理部门:</td>
						<td width="150px"><input type="text" name="actionUnit" class="easyui-combobox" id="office_actionUnit" data-options="novalidate:true,required:true,prompt:'请选择处理部门',missingMessage:'处理部门必选',editable:false,valueField:'ID',textField:'UNIT_NAME',url:'../units/unitsExtMy'" /></td>
						<td width="100">截止时间:</td><!-- nowTime -->
						<td width="150px"><input type="text" name="endTime" id="office_endTime" onfocus="WdatePicker({minDate:'${nowTime!''}'})" class="easyui-validatebox" data-options="novalidate:true,required:true,prompt:'请选择截止时间',missingMessage:'截止时间为必选项'" /></td>
					</tr>
				</table>
			</div>
			<!-- 单据编号 -->
			<input type="hidden" name="com_bill_id" id="hid_office_com_bill_id" value="" />
			<!-- 流转单编号 -->
			<input type="hidden" name="cir_bill_id" id="hid_office_cir_bill_id" value="" />
			<input type="hidden" name="action_bill_id" id="hid_office_action_bill_id" value="" />
			<div>
				<table align="center">
					<tr>
						<td width="100px" valign="top">内容:</td>
						<td width="400px">
							<input class="easyui-textbox" data-options="novalidate:true,required:true,prompt:'此项必填',missingMessage:'此项必填',multiline:true" style="height:170px;width:350px;" type="text" name="context"></input>
						</td>
					</tr>
				</table>
			</div>
			<div style="width: 99%; height:50px;">
			</div>
			<div style="width: 100%; text-align: center; line-height: 40px;">
				<a href="javascript:void(0)" class="easyui-linkbutton" id="btn_office_send" iconCls="icon-redo">发送</a>
			</div>
		</form>
	</div>
	<!-- 处理窗口 其他部门流转信息 -->
	<div id="div_action_other_window" class="easyui-window" title="处理信息"  data-options="modal:true,collapsible:false,closed:true,minimizable:false,
		maximizable:false" style="padding: 15px; width:550px; line-height: 20px;">
		<div id="div_other_comBill_info"></div>
		<div>
			<table align="center">
				<tr>
					<td width="100px" valign="top">截止日期:</td>
					<td width="400px" id="other_comBill_endDate">
						
					</td>
				</tr>
			</table>
		</div>
		<form id="form_other_action" method="post" class="easyui-form" data-options="novalidate:true">
			<!-- 单据编号 -->
			<input type="hidden" name="com_bill_id" id="hid_other_com_bill_id" value="" />
			<!-- 流转单编号 -->
			<input type="hidden" name="cir_bill_id" id="hid_other_cir_bill_id" value="" />
			<!-- 处理类型 -->
			<input type="hidden" name="other_type" id="hid_other_type" value="" />
			<div>
				<table align="center">
					<tr>
						<td width="100px" valign="top">内容:</td>
						<td width="400px">
							<input class="easyui-textbox" data-options="novalidate:true,required:true,prompt:'请输入内容',missingMessage:'内容为必填项',multiline:true" style="height:170px;width:350px;" type="text" name="context" value=""></input>
						</td>
					</tr>
				</table>
			</div>
			<div style="width: 99%; height:50px;">
			</div>
			<div style="width: 100%; text-align: center; line-height: 40px;">
				<a href="javascript:void(0)" class="easyui-linkbutton" id="btn_other_send" iconCls="icon-redo">发送</a>
				<a href="javascript:void(0)" class="easyui-linkbutton" id="btn_other_back" iconCls="icon-undo">驳回</a>
			</div>
		</form>
	</div>
	<!-- 处理窗口 办公室流转信息 -->
	<div id="div_action_window" class="easyui-window" title="处理信息"  data-options="modal:true,collapsible:false,closed:true,minimizable:false,
		maximizable:false" style="padding: 15px; width:550px; line-height: 20px;">
		<div id="div_comBill_info"></div>
		<form id="form_action" method="post" class="easyui-form" data-options="novalidate:true">
			<!-- 单据编号 -->
			<input type="hidden" name="com_bill_id" id="hid_com_bill_id" value="" />
			<!-- 流转单编号 -->
			<input type="hidden" name="cir_bill_id" id="hid_cir_bill_id" value="" />
			<div>
				<table align="center">
					<tr>
						<td width="100px">处理部门:</td>
						<td width="150px"><input type="text" name="actionUnit" class="easyui-combobox" id="actionUnit" data-options="novalidate:true,required:true,prompt:'请选择处理部门',missingMessage:'处理部门必选',editable:false,valueField:'ID',textField:'UNIT_NAME',url:'../units/unitsExtMy'" /></td>
						<td width="100">截止时间:</td><!-- nowTime -->
						<td width="150px"><input type="text" name="endTime" onfocus="WdatePicker({minDate:'${nowTime!''}'})" class="easyui-validatebox" data-options="novalidate:true,required:true,prompt:'请选择截止时间',missingMessage:'截止时间为必选项'" /></td>
					</tr>
				</table>
			</div>
			<div style="width: 99%; height:100px;">
			</div>
			<div style="width: 100%; text-align: center; line-height: 40px;">
				<a href="javascript:void(0)" class="easyui-linkbutton" id="btn_send" iconCls="icon-redo">发送</a>
			</div>
		</form>
	</div>
	<!-- 单据信息 -->
	<table id="table_comBill_info" align="center">
		<tr>
			<td width="100px">客户姓名:</td>
			<td width="150px"><span id="span_custname"></span></td>
			
			<td width="100px">客户电话:</td>
			<td width="150px"><span id="span_phone"></span></td>
		</tr>
		<tr>
			<td valign="top">地址:</td>
			<td colspan="3"><span id="span_address"></span></td>
		</tr>
		<tr>
			<td valign="top">原因:</td>
			<td colspan="3"><span id="span_reason"></span></td>
		</tr>
		<tr>
			<td valign="top">内容:</td>
			<td colspan="3"><span id="span_content"></span></td>
		</tr>
	</table>
</body>
</html>
<@h.easyui />
<script type="text/javascript">
jQuery(document).ready(function(){
	//处理按钮事件
	jQuery("#btn_action").click(function(){
		var row = jQuery("#datagrid").datagrid("getSelected");
		if(!row){
			jQuery.messager.alert("系统提示","请先选中记录!","warning");
		}
		if(row.ACTIVE!="0"){
			jQuery.messager.alert("系统提示","此信息已经处理过!","warning");
			return;
		}
		jQuery.ajax({
			async:false,
			type:"post",
			dataType:"json",
			data:{id:row.ID,src_unit_id:row.SRC_UNIT_ID,bill_id:row.BILL_ID},
			url:"doActionInfo",
			success:function(info){
				if(!info.success){
					jQuery.messager.alert("系统提示",info.message,"warning");
					return;
				}
				var data = info.data;
				if("customer"==data.srctype){
					jQuery("#div_comBill_info").empty();
					fillCombill(data);
					var comBill_info = jQuery("#table_comBill_info").clone();
					jQuery("#div_comBill_info").append(comBill_info);
					
					jQuery("#form_action").form("clear");
					jQuery("#form_action").form("disableValidation");
					jQuery("#hid_com_bill_id").val(data.COM_BILL_ID);
					jQuery("#hid_cir_bill_id").val(data.CIR_BILL_ID);
					jQuery("#div_action_window").window("open");
					jQuery("#div_action_window").window("center");
					return;
				}
				if("office"==data.srctype){
					jQuery("#div_other_comBill_info").empty();
					fillCombill(data);
					var comBill_info = jQuery("#table_comBill_info").clone();
					jQuery("#div_other_comBill_info").append(comBill_info);
					jQuery("#other_comBill_endDate").empty();
					jQuery("#other_comBill_endDate").append(row.ACTION_END_TIME);
					
					jQuery("#form_other_action").form("clear");
					jQuery("#form_other_action").form("disableValidation");
					jQuery("#hid_other_com_bill_id").val(data.COM_BILL_ID);
					jQuery("#hid_other_cir_bill_id").val(data.CIR_BILL_ID);
					jQuery("#div_action_other_window").window("open");
					jQuery("#div_action_other_window").window("center");
					return;
				}
				if("other"==data.srctype){
					jQuery("#div_office_comBill_info").empty();
					fillCombill(data);
					var comBill_info = jQuery("#table_comBill_info").clone();
					jQuery("#div_office_comBill_info").append(comBill_info);
					
					jQuery("#form_office_action").form("clear");
					jQuery("#form_office_action").form("disableValidation");
					
					jQuery("#td_office_answer").empty();
					jQuery("#td_office_answer").append(data.ACTION_TYPE);
					jQuery("#td_office_reson").empty();
					jQuery("#td_office_reson").append(data.ACTION_CONTEXT);
					jQuery("#td_office_unitname").empty();
					jQuery("#td_office_unitname").append(data.UNIT_NAME);
					jQuery("#hid_office_com_bill_id").val(data.COM_BILL_ID);
					jQuery("#hid_office_cir_bill_id").val(data.CIR_BILL_ID);
					jQuery("#hid_office_action_bill_id").val(data.ACTION_BILL_ID);
					
					jQuery("#div_action_office_window").window("open");
					jQuery("#div_action_office_window").window("center");
					return;
				}
				if("end"==data.srctype){
					jQuery("#div_end_comBill_info").empty();
					fillCombill(data);
					var comBill_info = jQuery("#table_comBill_info").clone();
					jQuery("#div_end_comBill_info").append(comBill_info);
					
					jQuery("#form_end_action").form("clear");
					jQuery("#form_end_action").form("disableValidation");
					
					jQuery("#td_end_exam_content").empty();
					jQuery("#td_end_exam_content").append(data.EXAM_CONTENT);
					jQuery("#hid_end_com_bill_id").val(data.COM_BILL_ID);
					jQuery("#hid_end_cir_bill_id").val(data.CIR_BILL_ID);
					jQuery("#hid_end_exa_bill_id").val(data.EXAM_ID);
					
					jQuery("#div_end_action_window").window("open");
					jQuery("#div_end_action_window").window("center");
				}
			}
		});
	});
	//发送按钮事件
	jQuery("#btn_send").click(function(){
		if(!jQuery("#form_action").form("enableValidation").form("validate")){
			return;
		}//doAction
		jQuery("#form_action").form("submit",{
			success:function(data){
				var obj = eval('(' + data + ')');
				if(obj.success){
					jQuery("#div_action_window").window("close");
					jQuery("#datagrid").datagrid("reload");
				}else{
					jQuery.messager.alert("系统提示",obj.message,"info");
				}
			},
			url:"doAction"
		});
	});
	//其他部门发送按钮事件
	jQuery("#btn_other_send").click(function(){
		jQuery("#hid_other_type").val("0");
		otherFormAction();
	});
	//其他部门驳回按钮事件
	jQuery("#btn_other_back").click(function(){
		jQuery("#hid_other_type").val("1");
		otherFormAction();
	});
	jQuery("#btn_end_answer").click(function(){
		if(!jQuery("#form_end_action").form("enableValidation").form("validate")){
			return;
		}//doAction
		jQuery("#form_end_action").form("submit",{
			success:function(data){
				var obj = eval('(' + data + ')');
				if(obj.success){
					jQuery("#div_end_action_window").window("close");
					jQuery("#datagrid").datagrid("reload");
				}else{
					jQuery.messager.alert("系统提示",obj.message,"info");
				}
			},
			url:"doAction"
		});
	});
	jQuery("#btn_office_send").click(function(){
		if(!jQuery("#form_office_action").form("enableValidation").form("validate")){
			return;
		}//doAction
		jQuery("#form_office_action").form("submit",{
			success:function(data){
				var obj = eval('(' + data + ')');
				if(obj.success){
					jQuery("#div_action_office_window").window("close");
					jQuery("#datagrid").datagrid("reload");
				}else{
					jQuery.messager.alert("系统提示",obj.message,"info");
				}
			},
			url:"doAction"
		});
	});
});
function otherFormAction(){
	if(!jQuery("#form_other_action").form("enableValidation").form("validate")){
		return;
	}//doAction
	jQuery("#form_other_action").form("submit",{
		success:function(data){
			var obj = eval('(' + data + ')');
			if(obj.success){
				jQuery("#div_action_other_window").window("close");
				jQuery("#datagrid").datagrid("reload");
			}else{
				jQuery.messager.alert("系统提示",obj.message,"info");
			}
		},
		url:"doAction"
	});
}
//填充单据信息
function fillCombill(data){
	//清空
	jQuery("#span_custname").empty();
	jQuery("#span_phone").empty();
	jQuery("#span_address").empty();
	jQuery("#span_reason").empty();
	jQuery("#span_content").empty();
	//加信息
	jQuery("#span_custname").append(data.CUSTOMER_NAME);
	jQuery("#span_phone").append(data.CMPHONE);
	jQuery("#span_address").append(data.CUST_ADDRESS);
	jQuery("#span_reason").append(data.REASON);
	jQuery("#span_content").append(data.CONTENT);
}
</script>